<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<html>
<head>
    <title>用户管理</title>
    <meta name="decorator" content="default"/>
    <script type="text/javascript">
        $(document).ready(function () {
            $("#no").focus();
            $("#inputForm").validate({
                rules: {
                    loginName: {remote: "${ctx}/sys/user/checkLoginName?oldLoginName=" + encodeURIComponent('${user.loginName}')}
                },
                messages: {
                    loginName: {remote: "用户登录名已存在"},
                    confirmNewPassword: {equalTo: "输入与上面相同的密码"}
                },
                submitHandler: function (form) {
                    loading('正在提交，请稍等...');
                    form.submit();
                },
                errorContainer: "#messageBox",
                errorPlacement: function (error, element) {
                    $("#messageBox").text("输入有误，请先更正。");
                    if (element.is(":checkbox") || element.is(":radio") || element.parent().is(".input-append")) {
                        error.appendTo(element.parent().parent());
                    } else {
                        error.insertAfter(element);
                    }
                }
            });
        });
    </script>
</head>
<body>
<ul class="nav nav-tabs">
    <li><a href="${ctx}/sys/user/list">用户列表</a></li>
    <li class="active">
        <a href="${ctx}/sys/user/form?id=${user.id}">用户
            <shiro:hasPermission name="sys:user:edit">${not empty user.id?'修改':'添加'}</shiro:hasPermission>
            <shiro:lacksPermission name="sys:user:edit">查看</shiro:lacksPermission>
        </a>
    </li>
</ul>
<br/>
<form:form id="inputForm" modelAttribute="report" action="${ctx}/report/config/save" method="post" class="form-horizontal">
    <sys:message content="${message}"/>
    <form:hidden path="reportId"/>

    <div class="control-group">
        <label class="control-label">报表名称:</label>
        <div class="controls">
            <form:input path="reportName" htmlEscape="false" maxlength="50" class="required"/>
            <span class="help-inline"><font color="red">*</font> </span>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">归属子系统:</label>
        <div class="controls">
            <form:select path="subSysCode" class="w-input280 required">
                <form:option value="" label="请选择"/>
                <form:option value="EB010" label="HUI买"/>
                <form:option value="EB011" label="HUI伙"/>
            </form:select>
            <span class="help-inline"><font color="red">*</font> </span>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">是否支持导出:</label>
        <div class="controls">
            <input class="inp-radio required" type="radio" name="isExport" value="1"
                   <c:if test="${report.isExport=='1'}">checked="checked"</c:if>><span class="b-radio mgl-10"><b></b>是</span>
            <input class="inp-radio" type="radio" name="isExport" value="0"
                   <c:if test="${report.isExport=='0'}">checked="checked"</c:if>><span class="b-radio mgl-20"><b></b>否</span>
            <span class="help-inline"><font color="red">*</font> </span>
        </div>
    </div>
    <div class="control-group" <c:if test="${report.isExport == null || report.isExport=='0'}">style="display: none;"</c:if>>
        <label class="control-label">导出方式:</label>
        <div class="controls">
            <input class="inp-radio " type="radio" name="isExportAsyn" value="0"
                   <c:if test="${report.isExportAsyn=='0'}">checked="checked"</c:if>><span class="b-radio mgl-10"><b></b>同步</span>
            <input class="inp-radio " type="radio" name="isExportAsyn" value="1"
                   <c:if test="${report.isExportAsyn=='1'}">checked="checked"</c:if>><span class="b-radio mgl-20"><b></b>异步</span>
            <input class="inp-radio " type="radio" name="isExportAsyn" value="2"
                   <c:if test="${report.isExportAsyn=='2'}">checked="checked"</c:if>><span class="b-radio mgl-10"><b></b>都支持</span>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">报表说明:</label>
        <div class="controls">
            <form:input path="reportNote" htmlEscape="false" maxlength="50" class="required"/>
            <span class="help-inline"><font color="red">*</font> </span>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">菜单编码:</label>
        <div class="controls">
            <form:input path="menuCode" htmlEscape="false" maxlength="50" placeholder="用于配置报表的菜单归属" class="required"/>
            <span class="help-inline"><font color="red">*</font> </span>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">查询sql:</label>
        <div class="controls">
            <form:textarea path="sqlRef" htmlEscape="false" rows="3" maxlength="200" class="input-xlarge"/>
            <span class="help-inline"><font color="red">*</font> </span>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">储存过程Sql块:</label>
        <div class="controls">
            <textarea name="proce" id="proce" htmlEscape="false" rows="3" maxlength="200"
                      class="input-xlarge">${fn:escapeXml(report.proce)}</textarea>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">储存过程执行频率:</label>
        <div class="controls">
            <form:input path="proceCron" htmlEscape="false" maxlength="50" class="required"/>
            <span class="help-inline"><font color="red">*</font> </span>
        </div>
    </div>

    <div class="control-group">
        <label class="control-label">储存过程Sql块:</label>
        <div class="controls">
            <form:textarea path="remark" htmlEscape="false" rows="3" maxlength="200" class="input-xlarge"
                           placeholder="请备注该报表各个指标值的sql和指标值之间的关系，方便维护"/>
        </div>
    </div>

    <div class="form-actions">
        <shiro:hasPermission name="report:configIn:edit">
            <input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;
        </shiro:hasPermission>
        <input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
    </div>

</form:form>

<script src="${ctxStatic}/jquery-validation/1.11.0/jquery.validate.min.js" type="text/javascript"></script>
<script type="text/javascript">
</script>
</body>
</html>